<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/chosen.jquery.js" type="text/javascript"></script>
<!-- CSS -->
<!--<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/datepicker.css" media="screen, tv, projection" title="Default" />
<script type="text/javascript" src="<?= base_url() ?>js/datepicker.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>css/chosen.css" />
<style type="text/css">
table.stats{
	text-align: center;
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;
	font-weight: normal;
	font-size: 11px;
	color: #900000;
	width: 220px;
	background-color: red;
	border: 0px;
	border-collapse: collapse;
	border-spacing: 0px;}

table.stats td{
	background-color: #900000;
	color: #fff;
	padding: 4px;
	text-align: left;
	border: 1px #FFABAB solid;}

table.stats td.hed{
	background-color: #E73737;
	color: #fff;
	padding: 4px;
	text-align: left;
	border-bottom: 2px #FFABAB solid;
	font-size: 12px;
	font-weight: bold;}
</style>
<div id="container">
	<?
    //Setting Awal Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	$param_exp=explode("#",$param_id);
	$value = array(
		'id_sekolah'			=> "",
		'tahun_ajaran'			=> $tahunajaran->row()->TAHUN_AJARAN,
		'kode_mp'				=> $pelajaran->row()->NAMA_MATA_PELAJARAN,
		'kode_penilaian'		=> "",
		'nilai_min1'			=> "",
		'nilai_min2'			=> "",
		'nilai_min3'			=> "",
		'nilai_min4'			=> "",
		'nilai_min5'			=> "",
		'nilai_min6'			=> "",
		'nilai_min7'			=> "",
		'nilai_min8'			=> "",
		'nilai_min9'			=> "",
		'nilai_min10'			=> "",
		'nilai_max1'			=> "",
		'nilai_max2'			=> "",
		'nilai_max3'			=> "",
		'nilai_max4'			=> "",
		'nilai_max5'			=> "",
		'nilai_max6'			=> "",
		'nilai_max7'			=> "",
		'nilai_max8'			=> "",
		'nilai_max9'			=> "",
		'nilai_max10'			=> "",
		'grade1'				=> "",
		'grade2'				=> "",
		'grade3'				=> "",
		'grade4'				=> "",
		'grade5'				=> "",
		'grade6'				=> "",
		'grade7'				=> "",
		'grade8'				=> "",
		'grade9'				=> "",
		'grade10'				=> "",
		'keterangan'			=> "",
		'legend'				=> "Form Input Grading Mata Pelajaran",
		'info'					=> "Form input Grading Mata Pelajaran",
		'act_form'				=> "grading/input_grading/".$param_exp[0]
	);
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
		$j=1;
		foreach($rs_grading->result() as $row){
			$value['id_sekolah'] = $row->ID_SEK;
			$value['tahun_ajaran'] = $row->ID_TA;
			$value['kode_mp'] = $row->KODE_MATA_PELAJARAN;
			// $value['kode_penilaian'] = $row->KODE_PENILAIAN;
			$value['nilai_min'.$j] = $row->NILAI_MIN;
			$value['nilai_max'.$j] = $row->NILAI_MAX;
			$value['grade'.$j] = $row->GRADE;
		$j++;
		}
		for($i=$j+1;$i<=10;$i++){
			$value['nilai_min'.$i] = '';
			$value['nilai_max'.$i] = '';
			$value['grade'.$i] = '';
		}
		$value['legend'] = "Form Input Grading Mata Pelajaran";
		$value['info'] = "Form Input Grading Mata Pelajaran";
		$value['act_form'] = "grading/edit_grading/".$param_exp[0];
	}//end if
	
	?>
	<?= form_open($value["act_form"],'class="wufoo" name="form_grading"'); ?>
	<fieldset class="fieldset">
	<legend class="legend">
		<?= $value["legend"] ?> |
	</legend>
	
	<div class="info">
		<div><?= $value["info"] ?></div>
	</div>
	<div>
		<?= anchor(site_url('grading/index/'.$param_exp[0].'/'.$param_exp[1].'/'.$param_exp[2]),img(array('src'=>'images/main/38.png','border'=>'0','alt'=>'')).' Kembali ke daftar Grading Per Mata Pelajaran','Menampilkan halaman Daftar Grading Per Mata Pelajaran'); ?>
	
	</div>
	<?php if (!empty($err_msg)): ?>
		<div class="ret_error">
			<?php echo $err_msg; ?>
		</div>
	<?php endif; ?>
 <!-- Konten -------------------------------------------------------------------------->
 <div id="contentform">
	<ul>
		<?php if($this->session->userdata('roleid')=='0'){ //diknas ?>
		<li>
			<label class="desc">Nama Sekolah *</label>
			 <div>
                <? 
                //list sekolah
				$options_sekolah[''] = "-- Pilih Sekolah --";
				foreach($sekolah->result() as $row_sekolah){
					$options_sekolah[$row_sekolah->ID_SEKOLAH] = $row_sekolah->NAMA_SEKOLAH; 
				}
				echo form_dropdown('nama_sekolah',$options_sekolah,$value['id_sekolah'],'class="field select"');	
                ?>
            </div>
            <p class="instruct">
                Pilih Sekolah Pada Kolom ini, jika tidak ada dalam daftar maka inputkan pada Data Sekolah terlebih dahulu.			
            </p>
		</li>
		<?php echo form_error('nama_sekolah'); ?>
		<?}?>
		
		<li>
			<label class="desc">Tahun Ajaran *</label>
			 <div>
				<input class="field text" disabled type="text" maxlength="12" size="12" name="tahun_ajaran"  style="background:#e0e2e3" value="<?php echo $tahunajaran->row()->TAHUN_AJARAN?>"/> 
				<input type="hidden" name="tahun_ajaran" id="tahun_ajaran" value="<? if(set_value('tahun_ajaran')!='') echo set_value('tahun_ajaran'); else echo $value['tahun_ajaran'];?>">
			</div>
            <p class="instruct">
                Pilih tahun ajaran Pada Kolom ini, jika tidak ada dalam daftar maka inputkan pada Daftar tahun ajaran terlebih dahulu.			
            </p>
		</li>
		<?php echo form_error('tahun_ajaran'); ?>
		
		<li>
			<label class="desc">Mata Pelajaran *</label>
			<div>
				<input class="field text " disabled type="text" maxlength="50" size="50" name="kode_mp"  style="background:#e0e2e3" value="<?php echo $pelajaran->row()->NAMA_MATA_PELAJARAN?>"/> 
				<input type="hidden" name="kode_mp" id="kode_mp" value="<?php echo $param_exp[0]?>">
			</div>
		</li>
		<?php echo form_error('kode_mp'); ?>
		<!--
		<li>
			<label class="desc">Aspek Penilaian *</label><?//php echo var_dump($value['kode_penilaian'])?>
			 <div>
                <? 
                //list aspek
				// $options_aspek[''] = "-- Pilih Aspek Penilaian --";
				// foreach($aspek_nilai->result() as $row_aspek){
					// $options_aspek[$row_aspek->ID_ASPEK] = $row_aspek->ASPEK_PENILAIAN; 
				// }
				// if($status=='new')
					// echo form_dropdown('kode_penilaian',$options_aspek,$value['kode_penilaian'],'class="field select"');	
				// else{
					// echo form_dropdown('kode_penilaian',$options_aspek,$value['kode_penilaian'],'class="field select" style="background:#e0e2e3" disabled');
					// echo '<input type="hidden" name="kode_penilaian" id="kode_penilaian" value="'.$value['kode_penilaian'].'">';
				// }?>
            </div>
            <p class="instruct">
                Pilih Aspek Penilaian Pada Kolom ini, jika tidak ada dalam daftar maka inputkan pada Menu Kurikulum >> Aspek Penilaian terlebih dahulu.			
            </p>
		</li>
		<?//php echo form_error('kode_penilaian'); ?>
		-->
		<li>
			<label class="desc">Grading (Skala 1-100)</label>
			<table class="stats" cellspacing="0">
				<tr><td align="center">No.</td>
					<td colspan="2" nowrap align="center">Nilai Min - Nilai Max</td>
					
					<td align="center">Grade</td>
				</tr>
				<?for($i=1;$i<=10;$i++){?>
				<tr><td class="hed"><?php echo $i;?></td>
					<td class="hed"><input class="field text" type="text" maxlength="5" size="5" name="nilai_min<?php echo $i;?>" value="<? if(set_value('nilai_min'.$i)!='') echo set_value('nilai_min'.$i); else echo $value['nilai_min'.$i];?>"/> </td>
					<td class="hed"><input class="field text" type="text" maxlength="5" size="5" name="nilai_max<?php echo $i;?>" value="<? if(set_value('nilai_max'.$i)!='') echo set_value('nilai_max'.$i); else echo $value['nilai_max'.$i];?>"/> </td>
					<td class="hed"><input class="field text" type="text" maxlength="2" size="5" name="grade<?php echo $i;?>" value="<? if(set_value('grade'.$i)!='') echo set_value('grade'.$i); else echo $value['grade'.$i];?>"/> </td>
				</tr>
				<?}?>
			</table>
		</li>
		<!--<li>
			<label class="desc">Keterangan</label>
			<div>
				<textarea rows="5" cols="30" name="keterangan" value="<? if(set_value('keterangan')!='') echo set_value('keterangan'); else echo $value['keterangan'];?>"><?=$value['keterangan']?></textarea>
			</div>
			<p class="instruct">
				Masukkan Keterangan Pada Kolom ini.			
			</p>
		</li>
		<?//php echo form_error('keterangan'); ?>
		-->
		
		<li class="buttons">
		  <input id="saveForm" class="btTxt" type="submit" value="Simpan" />
		  <input name="submit" type="reset" value="Batal" />
		</li>
	</ul>
</div>
</fieldset>

<script type="text/javascript">
  $(".chzn-select").chosen();
  $(".chzn-select-deselect").chosen({allow_single_deselect:true});
</script>	
<?= form_close(); ?>
</form>
</div><!--container-->